// console.log(document.querySelector(".boss"));
let prev = document.querySelector(" #prev");
// console.log(prev)
let next = document.querySelector("#next");
// console.log(next)
let box = document.getElementById("box");
// console.log(box)
let totalList = document.querySelectorAll("#box .total");
// console.log(totalList)
let dotList = document.querySelectorAll("#dot li")
// console.log(dotList)
let n = 0;//初始化下标
// 向右箭头
next.onclick=function(){
	if(n !==totalList.length-1){
		n++;
	}
	else{
		n=0;
	}
	changeImg()
}
//向左箭
prev.onclick=function(){
	if(n===0){
		n = totalList.length-1;
	}
	else{
		n--;
	}
	changeImg()
}
function changeImg(){
	for(var i=0;i<totalList.length;i++){
		totalList[i].className ="";
	}
	switch(n){
		case 0:
			totalList[0].className = "total total-1 show";break;
		case 1:
			totalList[1].className = " total total-2 show";break;
		case 2:
			totalList[2].className = "total total-3 show";break;
		case 3:
			totalList[3].className = "total total-4 show";break;
		case 4:
			totalList[4].className = "total total-5 show";break;
	}
	for(var m=0;m<dotList.length;m++){
		dotList[m].className=""
	}
	dotList[n].className="focus"
}
// 自动播放
let autoOne =setInterval(function(){
	next.click()
},3000)
//小圆点点击功能
for(var k=0;k<dotList.length;k++){
	dotList[k].setAttribute("list",k);
	dotList[k].onclick=function(){
		for(var j=0;j<dotList.length;j++){
			dotList[j].className=""
		}
		n=Number(this.getAttribute("list"))
		changeImg()
	}
}
// --------------------------------------------------------
//飘窗定位动画
let track = document.querySelector(".track")
///关闭按钮
let close = document.querySelector(".close")
close.onclick=function(){
	track.style.display = "none"
}
//移动飘窗
let autoThree=setTimeout(()=>{
	track.style.display="block"
	track.style.left = "100px";
	track.style.top="100px"
	let autoTwo = setInterval(()=>{
		let L = parseInt(track.style.left)
		let T = parseInt(track.style.top)
		if(L>=800){
			clearInterval(autoTwo);
			track.style.left = "1100px";
			track.style.top ="700px"
			return;
		}
		track.style.left = L+31.25+"px";
		track.style.top = T+19.2+"px"
	},32)
},3000)
// ------------------------------------------------------------------
//content 1 2 3 4跳出来
let Timer01=setTimeout(()=>{
	$(".content-1").css({
		"transform":"translateY(-110px)",
		"transition":"all 0.6s"
	})
},500)
let Timer02=setTimeout(()=>{
	$(".content-2").css({
		"transform":"translateY(-110px)",
		"transition":"all 0.6s"
	})
},2500)
let Timer03=setTimeout(()=>{
	$(".content-3").css({
		"transform":"translateY(-110px)",
		"transition":"all 0.6s"
	})
},4500)
let Timer04=setTimeout(()=>{
	$(".content-4").css({
		"transform":"translateY(-110px)",
		"transition":"all 0.6s"
	})
},6500)

let TimerV1=setTimeout(()=>{
	$(".se-v1").css({
		"margin-top":"0",
		"opacity":"1",
		"transition":"all 1s"
	})
},200)
// ---------------------------------
let official=document.getElementById("official")
official.style.marginLeft=0;
let autoFour=setInterval(()=>{
	let ml = parseInt(official.style.marginLeft);
	if(ml<=-1500){
		official.style.marginLeft="0"
		return;
	}
	official.style.marginLeft=ml-5+"px";
},16)
//鼠标移上
official.onmouseenter=function(){
	clearInterval(autoFour)
}
//鼠标离开
official.onmouseleave=function(){
	autoFour=setInterval(()=>{
		let ml = parseInt(official.style.marginLeft);
		if(ml<=-1500){
			official.style.marginLeft="0"
			return;
		}
		official.style.marginLeft=ml-5+"px";
	},16)
}
//放大一
let liLef=document.querySelectorAll(".li-lef img")
// console.log(liLef)
for(let i=0;i<liLef.length;i++){
	liLef[i].onmouseenter=function(){
		liLef[i].style.transform="scale(1.3)"
		liLef[i].style.transition="all 1s"
	}
	liLef[i].onmouseleave=function(){
		liLef[i].style.transform="scale(1)"
		liLef[i].style.transition="all 1s"
	}
}
// -------------------------------------------------------

let shopList=document.querySelectorAll(".shop-01-fir")
let l =document.getElementById("l")
let r=document.getElementById("r")
let shopLefImg=document.querySelectorAll(".shop-lef img")
let index=0;

r.onclick=function(){
	if(index!==shopList.length-1){
		index++;
	}
	else{
		index=0;
	}
	changeShop()
}
l.onclick=function(){
	if(index===0){
		index=shopList.length-1;
	}
	else{
		index--;
	}

	changeShop()
}
function changeShop(){
	for(let i=0;i<shopList.length;i++){
		shopList[i].id="";
		// shopLefImg[i].style.transform="scale(1)"
	}
	shopList[index].id="active";
	// shopLefImg[index].style.transform="scale(1.3)"
}
let autoplayShop=setInterval(()=>{
	l.click()
},3000)

// -------------------------------
//吸顶效果
window.onscroll=function(){
	if(document.documentElement.scrollTop>=60){
		$(".head").css({
			"backgroundColor":"white"
		})
		$(".head a").css({
			"color":"black"
		})
		$(".head span").css({
			"color":"black"
		})
		$(".head #loginBtn").css({
			"color":"red",
			"border":"1px solid red"
		})
		$(".head #registerBtn").css({
			"color":"white",
			"backgroundColor":"red"
		})
	}
	else{
		$(".head").css({
			"backgroundColor":"rgba(0,0,0,0)"
		})
		$(".head a").css({
			"color":"white"
		})
		$(".head span").css({
			"color":"white"
		})
		$(".head #loginBtn").css({
			"color":"white",
			"border":"1px solid white"
		})
		$(".head #registerBtn").css({
			"color":"red",
			"backgroundColor":"white"
		})
	
	}
}
